Solving 10385 - Duathlon (Ternary search)
[andmenj-acm.git] / 10098 - Generating fast, sorted permutation / 10098.cpp
blobeeb680dc1e36d1f1825b63870a87ac45fd887641
1 #include <iostream>
2 #include <algorithm>
3 #include <string>
5 using namespace std;
7 int main(){
8 int n;
9 cin >> n;
10 while (n--){
11 string s;
12 cin >> s;
13 sort(s.begin(), s.end());
14 do{
15 cout << s << endl;
16 }while(next_permutation(s.begin(), s.end()));
17 cout << endl;
19 return 0;